//
//  HFMainViewController.swift
//  sinaMicroBlog
//
//  Created by mac on 15/11/8.
//  Copyright © 2015年 mac. All rights reserved.
//

import UIKit

class HFMainViewController: UITabBarController {
    
    @objc private func composeDidClick() {
        let compose = HFComposeViewController()
        let nav = UINavigationController(rootViewController: compose)
        presentViewController(nav, animated: true, completion: nil)
    }


    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        let mainTabBar = HFMainTabBar()
        setValue(mainTabBar, forKey: "tabBar")
        addChildViewControllers()
        
        
    }
    private func addChildViewControllers() {
        addChildViewController(VC: HFHomeViewController(), title: "首页", imageName: "tabbar_home")
        addChildViewController(VC: HFDiscoverViewController(), title: "发现", imageName: "tabbar_discover")
        addChildViewController(VC: HFMessageViewController(), title: "消息", imageName: "tabbar_message_center")
        addChildViewController(VC: HFProfileViewController(), title: "我", imageName: "tabbar_profile")
        
    }
    private func addChildViewController(VC vc: UIViewController, title: String, imageName:String) {
        
        tabBar.tintColor = themeColor
        let nav = HFNavigationViewController(rootViewController: vc)
        
        vc.title = title
        vc.tabBarItem.image = UIImage(named: imageName)
        
        addChildViewController(nav)
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
